using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FiltronASP.Modules.Abstracts;
using FiltronASP.Models;
using FiltronASP.Models.DAO;
using FiltronASP.Models.DAO.Interfaces;

namespace FiltronASP.Modules
{
    public class countrySingleNewsModule : AbstractModule
    {
        private string currentCountryName = String.Empty;

        public override string GenerateContent(FiltronASP.Models.Page page) {
            this.currentCountryName = page.page_name;
            string htmlToReturn = String.Empty;
            IPageDAO pageDAO = new PageDAO();
            IVariableValueDAO variableValueDAO = new VariableValueDAO();
            IGalleryImageDAO galleryImageDAO = new GalleryImageDAO();

            VariableValue countriesVisibility = variableValueDAO.FindByVariableAndPage("countryNewsContent", page.page_id, Convert.ToInt32(page.language_id));
            VariableValue newsContent = variableValueDAO.FindByVariableAndPage("newsContent", page.page_id, Convert.ToInt32(page.language_id));
            GalleryImage newsPhoto = galleryImageDAO.FindByGalleryNameAndPage("newsPhoto", page.page_id).First();

            htmlToReturn += String.Format(" <span class=\"countryNewsSingleTopName\">{0}</span>", page.page_name);
            htmlToReturn += String.Format(" <div class=\"countryNewsContainer\">");
            htmlToReturn += String.Format("     <div class=\"countryNewsPhoto\"><img src=\"{0}\" alt=\"{1}\" /></div>", newsPhoto.gallery_image_link, newsPhoto.gallery_image_info);
            htmlToReturn += String.Format("     <div class=\"countryNewsContentFull\">{0}</div>", newsContent.variable_value);
            htmlToReturn += String.Format(" </div>");
            return htmlToReturn;
        }
    }
}
